home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-08-27 | 5.3 KB | 275 lines | [TEXT/MPS ] |
- /*------------------------------------------------------------------------------
- #
- # Exercise.r
- #
- # derived from MPW 3.1's "Sample", a MultiFinder-Aware Simple Sample Application
- #
- # Demonstrates how to use A/ROSE tasks for parallel processing
- # (one more program which computes Mandelbrot sets ...)
- #
- # One resizeable window; allows to select zoom-in rectangle
- # (was meant to be an introductory Macintosh C-programming exercise, originally)
- #
- # Refer to the original source code in the MPW CExamples folder for more comments
- #
- # Components:
- # Exercise.c
- # Exercise.r
- # Exercise.h
- # Exercise.make
- #
- ------------------------------------------------------------------------------*/
-
-
- #include "Types.r"
-
- #include "Exercise.h"
-
-
-
- resource 'MBAR' (rMenuBar, preload) {
- { mApple, mFile, mEdit};
- };
-
-
- resource 'MENU' (mApple, preload) {
- mApple, textMenuProc,
- AllItems & ~MenuItem2, /* Disable dashed line, enable About and DAs */
- enabled, apple,
- {
- "About Exercise…",
- noicon, nokey, nomark, plain;
- "-",
- noicon, nokey, nomark, plain
- }
- };
-
- resource 'MENU' (mFile, preload) {
- mFile, textMenuProc,
- MenuItem5, /* enable Quit only, program enables others */
- enabled, "File",
- {
- "New",
- noicon, "N", nomark, plain;
- "Open",
- noicon, "O", nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Close",
- noicon, "W", nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Reset",
- noicon, "R", nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Quit",
- noicon, "Q", nomark, plain
- }
- };
-
- resource 'MENU' (mEdit, preload) {
- mEdit, textMenuProc,
- NoItems, /* disable everything, program does the enabling */
- enabled, "Edit",
- {
- "Undo",
- noicon, "Z", nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Cut",
- noicon, "X", nomark, plain;
- "Copy",
- noicon, "C", nomark, plain;
- "Paste",
- noicon, "V", nomark, plain;
- "Clear",
- noicon, nokey, nomark, plain
- }
- };
-
-
-
- /* this ALRT and DITL are used as an About screen */
-
- resource 'ALRT' (rAboutAlert, purgeable) {
- {40, 20, 160, 300},
- rAboutAlert,
- { /* array: 4 elements */
- /* [1] */
- OK, visible, silent,
- /* [2] */
- OK, visible, silent,
- /* [3] */
- OK, visible, silent,
- /* [4] */
- OK, visible, silent
- }
- };
-
- resource 'DITL' (rAboutAlert, purgeable) {
- { /* array DITLarray: 5 elements */
- /* [1] */
- {88, 190, 108, 270},
- Button {
- enabled,
- "OK"
- },
- /* [2] */
- {8, 8, 24, 290},
- StaticText {
- disabled,
- "A/ROSE parallel processing exercise"
- },
- /* [3] */
- {32, 8, 48, 290},
- StaticText {
- disabled,
- "(derived from MPW:CExamples:Sample)"
- },
- /* [4] */
- {56, 8, 72, 136},
- StaticText {
- disabled,
- "Brought to you by:"
- },
- /* [5] */
- {80, 24, 112, 167},
- StaticText {
- disabled,
- "Joseph Maurer (EURO.DTS)"
- }
- }
- };
-
-
- /* this ALRT and DITL are used as an error screen */
-
- resource 'ALRT' (rUserAlert, purgeable) {
- {40, 20, 160, 280},
- rUserAlert,
- { /* array: 4 elements */
- /* [1] */
- OK, visible, silent,
- /* [2] */
- OK, visible, silent,
- /* [3] */
- OK, visible, silent,
- /* [4] */
- OK, visible, silent
- }
- };
-
-
- resource 'DITL' (rUserAlert, purgeable) {
- { /* array DITLarray: 3 elements */
- /* [1] */
- {80, 150, 100, 230},
- Button {
- enabled,
- "OK"
- },
- /* [2] */
- {10, 60, 60, 230},
- StaticText {
- disabled,
- "^0."
- },
- /* [3] */
- {8, 8, 40, 40},
- Icon {
- disabled,
- 2
- }
- }
- };
-
- resource 'STR ' (rTaskName, purgeable) {
- "MBTask"
- };
-
- resource 'STR ' (rTaskType, purgeable) {
- "MBServer"
- };
-
- resource 'STR ' (rClientName, purgeable) {
- "ClientApp"
- };
-
- resource 'STR ' (rClientType, purgeable) {
- "ClientType"
- };
-
-
- resource 'STR#' (rErrStrings, purgeable) {
- {
- "You must run on 512Ke or later";
- "Application Memory Size is too small";
- "Not enough memory to run TaskSample";
- "Cannot create window";
- "Cannot use A/ROSE Prep";
- "Task already registered";
- "<GetMsg> failed";
- "No Server task found";
- "Problem with ICC Manager";
- "Received message with unknown mCode";
- "Received undeliverable message";
- "Cannot allocate BitMap";
- }
- };
-
-
- resource 'WIND' (rWindow, preload, purgeable) {
- {50, 50, 210, 210},
- documentProc, visible, noGoAway, 0x0, "Exercise"
- };
-
-
- resource 'CNTL' (rCPUchk, "CPU - lines") {
- {160-kBottom+8, kBord, 160-kBottom+24, kBord+kCntPos},
- 0,
- visible,
- 1,
- 0,
- checkBoxProc,
- 0,
- "CPU - lines"
- };
-
- resource 'CNTL' (rMCPchk, "MCP - lines") {
- {160-kBottom+24, kBord, 160-kBottom+40, kBord+kCntPos},
- 0,
- visible,
- 1,
- 0,
- checkBoxProc,
- 0,
- "MCP - lines"
- };
-
-
-
- /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
-
- resource 'SIZE' (-1) {
- dontSaveScreen,
- acceptSuspendResumeEvents,
- enableOptionSwitch,
- canBackground, /* we can background; we don't currently, but our sleep value */
- /* guarantees we don't hog the Mac while we are in the background */
- multiFinderAware, /* this says we do our own activate/deactivate; don't fake us out */
- backgroundAndForeground, /* this is definitely not a background-only application! */
- dontGetFrontClicks, /* change this is if you want "do first click" behavior like the Finder */
- ignoreChildDiedEvents, /* essentially, I'm not a debugger (sub-launching) */
- not32BitCompatible, /* this app should not be run in 32-bit address space */
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- kPrefSize * 1024,
- kMinSize * 1024
- };
-